﻿using System;
using System.Windows.Media.Imaging;

namespace Schuifpuzzel.Model
{
    /// <summary>
    /// This class holds a score
    /// </summary>


    [Serializable()]
    public class Score: IComparable<Score>
    {
        public String Name;
        public int Time;
        public int Moves;
        [NonSerialized()] public BitmapSource Image; //Picture of the player

        public Score(int time, int moves, String name, BitmapSource image)
        {
            Time = time;
            Moves = moves;
            Name = name;
            Image = image;
        }
        
        /// <summary>
        /// Compares the score with a given score.
        /// </summary>
        /// <param name="score">The score to compare with</param>
        /// <returns></returns>

        public int CompareTo(Score score)
        {
            int result = Time.CompareTo(score.Time);
            if (result == 0)
            {
                return Moves.CompareTo(score.Moves);
            }
            return result;
            
        }
    }
}
